declare type MessageType = 1 | 2 | 3 | 4 | 5 | 6;

export class MessageBody {
  private _type: MessageType;
  private _body: any;

  constructor({type, body}) {
    this._body = body;
    this._type = type;
  }


  get type(): 1 | 2 | 3 | 4 | 5 | 6 {
    return this._type;
  }

  set type(value: 1 | 2 | 3 | 4 | 5 | 6) {
    this._type = value;
  }

  get body(): any {
    return this._body;
  }

  set body(value: any) {
    this._body = value;
  }

  toParams() {
    return {
      type: this.type,
      body: this.body
    };
  }
}
